$(document).ready(function(){
    // 选择热门、新游、资讯、新服
    // $(".navBox a").click(function(){
    //     $(this).addClass("hotnav").siblings().removeClass("hotnav");
    //     if($(this).index()==2){
    //         $(".informationBox").addClass("disb").removeClass("disn");
    //         $(".hotGameBox").addClass("disn").removeClass("disb");
    //     }else{
    //         $(".informationBox").addClass("disn").removeClass("disb");
    //         $(".hotGameBox").addClass("disb").removeClass("disn");
    //     }
    // });
    var swiper = new Swiper('.swiper-container', {
        pagination: '.swiper-pagination',
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable: true,
        spaceBetween: 30,
        centeredSlides: true,
        autoplay: 2500,
        autoplayDisableOnInteraction: false
    });

    // 加载失败情况
    // if(){
    // //如果连接失败：
        // $('.failBox').addClass('disb').removeClass('disn')
        // $('.headpage').addClass('disn').removeClass('disb')
    // }else{
        // $('.failBox').addClass('disn').removeClass('disb')
        // $('.headpage').addClass('disb').removeClass('disn')
    // }

    //热门游戏
    var htmlgame = '';
    var listgame = [];
    listgame = [
        {
            gamenamemin:'twcq',
            gameimg:'images/twcq.png',
            gamename:'天王传奇',
            gametitle:'十倍爆率，自动打怪，元宝回收',
        },
        {
            gamenamemin:'gycq',
            gameimg:'images/gycq.png',
            gamename:'公益传奇',
            gametitle:'怪物好打，装备好爆，元宝回收',
        },
        {
            gamenamemin:'wcyx',
            gameimg:'images/wcyx.png',
            gamename:'王城英雄',
            gametitle:'超变传奇，十倍爆率，小怪好打，装备好爆',
        },
        {
            gamenamemin:'xj',
            gameimg:'images/xj.png',
            gamename:'仙禁',
            gametitle:'角色任意转职，入圣成魔由你来定',
        },
        {
            gamenamemin:'rxwl',
            gameimg:'images/rxwl.png',
            gamename:'热血武林',
            gametitle:'注册有礼，装备全爆',
        },
        {
            gamenamemin:'ljsm',
            gameimg:'images/ljsm.png',
            gamename:'灵剑山盟',
            gametitle:'一剑东来，万剑归宗，仙本无道',
        }
    ];
    

    if(listgame.length<1){
    }else{
        for (var i = 0; i < listgame.length; i++) {
            htmlgame += '<div class="gameBox">'+
                            '<div class="gameImg"><img src="'+listgame[i].gameimg+'" /></div>'+
                            '<div class="gamecenBox">'+
                                '<h4>'+listgame[i].gamename+'<i></i><i></i></h4>'+
                                '<p>'+listgame[i].gametitle+'</p>'+
                            '</div>'+
                            '<div class="gameBtnBox">'+
                                '<button onclick="enterGame(\''+listgame[i].gamenamemin+'\')"><i></i>进入</button>'+
                            '</div>'+
                        '</div>'
        }
        $(".hotGameBox").html(htmlgame);
    };


    //点击搜索去搜索页
    $('.navBoxRight').click(function(){
        location.href='searchpage.html'
    })

    //点击重新加载
    $('.reload').click(function(){
        alert("测试")
    })
    
})
function toinformation(even){
    console.log(even)
    location.href='information.html?newpage='+even;
}